package com.sghj.utils.Validate.username;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 自定义用户名校验注解
 *
 * @author xrx
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER })
@Constraint(validatedBy = { UserNameValidator.class })
public @interface UserName
{
    String message()

    default "用户名不合法(必须以字母开头，长度为6-16位，不可包含中文及特殊字符)";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
